<template>
  <div>
    <van-nav-bar
      title="详情页"
      left-arrow
      @click-left="$router.back()"
    />

    <img :src="item.url" alt="" width="100%" height="200">
    <h1>{{ item.title }}</h1>
    <h3>{{ item.desc }}</h3>

  </div>
</template>


<script>
import axios from 'axios'
export default {
  created() {
    this.getDetail()
  },
  methods: {
    // 请求详情接口
    async getDetail() {
      const { id } = this.$route.params
      const resp = await axios.post('/api/detail', { id })
      this.item = resp.data.data
      console.log(this.item);
    }
  },
  data() {
    return {
      item: {}
    }
  }
}
</script>